<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class WIN32OLE::Variant - win32ole: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-array">::array</a>
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-5B-5D">#[]</a>
    <li ><a href="#method-i-5B-5D-3D">#[]=</a>
    <li ><a href="#method-i-value">#value</a>
    <li ><a href="#method-i-value-3D">#value=</a>
    <li ><a href="#method-i-vartype">#vartype</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-WIN32OLE::Variant">
    <h1 id="class-WIN32OLE::Variant" class="class">
      class WIN32OLE::Variant
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="Empty">Empty
          <dd><p>represents VT_EMPTY OLE object.</p>
          <dt id="NoParam">NoParam
          <dd><p>represents VT_ERROR variant with DISP_E_PARAMNOTFOUND. This constants is used for not specified parameter.</p>

<pre class="ruby"><span class="ruby-identifier">fso</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;Scripting.FileSystemObject&quot;</span>)
<span class="ruby-identifier">fso</span>.<span class="ruby-identifier">openTextFile</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-constant">WIN32OLE_VARIANT</span><span class="ruby-operator">::</span><span class="ruby-constant">NoParam</span>, <span class="ruby-keyword">false</span>)
</pre>
          <dt id="Nothing">Nothing
          <dd><p>represents <a href="Variant.html#Nothing"><code>Nothing</code></a> of VB.NET or VB.</p>
          <dt id="Null">Null
          <dd><p>represents VT_NULL OLE object.</p>
        </dl>
        </section>



                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-array" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          array(ary, vt)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns Ruby object wrapping OLE variant whose variant type is VT_ARRAY. The first argument should be Array object which specifies dimensions and each size of dimensions of OLE array. The second argument specifies variant type of the element of OLE array.</p>

<p>The following create 2 dimensions OLE array. The first dimensions size is 3, and the second is 4.</p>

<pre class="ruby"><span class="ruby-identifier">ole_ary</span> = <span class="ruby-constant">WIN32OLE_VARIANT</span>.<span class="ruby-identifier">array</span>([<span class="ruby-value">3</span>,<span class="ruby-value">4</span>], <span class="ruby-constant">VT_I4</span>)
<span class="ruby-identifier">ruby_ary</span> = <span class="ruby-identifier">ole_ary</span>.<span class="ruby-identifier">value</span> <span class="ruby-comment"># =&gt; [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]</span>
</pre>

                              <div class="method-source-code" id="array-source">
            <pre>static VALUE
folevariant_s_array(VALUE klass, VALUE elems, VALUE vvt)
{
    VALUE obj = Qnil;
    VARTYPE vt;
    struct olevariantdata *pvar;
    SAFEARRAYBOUND *psab = NULL;
    SAFEARRAY *psa = NULL;
    UINT dim = 0;
    UINT i = 0;

    ole_initialize();

    vt = RB_NUM2UINT(vvt);
    vt = (vt | VT_ARRAY);
    Check_Type(elems, T_ARRAY);
    obj = folevariant_s_allocate(klass);

    TypedData_Get_Struct(obj, struct olevariantdata, &amp;olevariant_datatype, pvar);
    dim = RARRAY_LEN(elems);

    psab = ALLOC_N(SAFEARRAYBOUND, dim);

    if(!psab) {
        rb_raise(rb_eRuntimeError, &quot;memory allocation error&quot;);
    }

    for (i = 0; i &lt; dim; i++) {
        psab[i].cElements = RB_FIX2INT(rb_ary_entry(elems, i));
        psab[i].lLbound = 0;
    }

    psa = SafeArrayCreate((VARTYPE)(vt &amp; VT_TYPEMASK), dim, psab);
    if (psa == NULL) {
        if (psab) free(psab);
        rb_raise(rb_eRuntimeError, &quot;memory allocation error(SafeArrayCreate)&quot;);
    }

    V_VT(&amp;(pvar-&gt;var)) = vt;
    if (vt &amp; VT_BYREF) {
        V_VT(&amp;(pvar-&gt;realvar)) = (vt &amp; ~VT_BYREF);
        V_ARRAY(&amp;(pvar-&gt;realvar)) = psa;
        V_ARRAYREF(&amp;(pvar-&gt;var)) = &amp;(V_ARRAY(&amp;(pvar-&gt;realvar)));
    } else {
        V_ARRAY(&amp;(pvar-&gt;var)) = psa;
    }
    if (psab) free(psab);
    return obj;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-new" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          new(val, vartype) #&rarr; WIN32OLE_VARIANT object.
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns Ruby object wrapping OLE variant. The first argument specifies Ruby object to convert OLE variant variable. The second argument specifies <a href="VARIANT.html"><code>VARIANT</code></a> type. In some situation, you need the WIN32OLE_VARIANT object to pass OLE method</p>

<pre class="ruby"><span class="ruby-identifier">shell</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;Shell.Application&quot;</span>)
<span class="ruby-identifier">folder</span> = <span class="ruby-identifier">shell</span>.<span class="ruby-constant">NameSpace</span>(<span class="ruby-string">&quot;C:\\Windows&quot;</span>)
<span class="ruby-identifier">item</span> = <span class="ruby-identifier">folder</span>.<span class="ruby-constant">ParseName</span>(<span class="ruby-string">&quot;tmp.txt&quot;</span>)
<span class="ruby-comment"># You can&#39;t use Ruby String object to call FolderItem.InvokeVerb.</span>
<span class="ruby-comment"># Instead, you have to use WIN32OLE_VARIANT object to call the method.</span>
<span class="ruby-identifier">shortcut</span> = <span class="ruby-constant">WIN32OLE_VARIANT</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;Create Shortcut(\&amp;S)&quot;</span>)
<span class="ruby-identifier">item</span>.<span class="ruby-identifier">invokeVerb</span>(<span class="ruby-identifier">shortcut</span>)
</pre>

                              <div class="method-source-code" id="new-source">
            <pre>static VALUE
folevariant_initialize(VALUE self, VALUE args)
{
    int len = 0;
    VARIANT var;
    VALUE val;
    VALUE vvt;
    VARTYPE vt;
    struct olevariantdata *pvar;

    len = RARRAY_LEN(args);
    rb_check_arity(len, 1, 3);
    VariantInit(&amp;var);
    val = rb_ary_entry(args, 0);

    check_type_val2variant(val);

    TypedData_Get_Struct(self, struct olevariantdata, &amp;olevariant_datatype, pvar);
    if (len == 1) {
        ole_val2variant(val, &amp;(pvar-&gt;var));
    } else {
        vvt = rb_ary_entry(args, 1);
        vt = RB_NUM2INT(vvt);
        if ((vt &amp; VT_TYPEMASK) == VT_RECORD) {
            rb_raise(rb_eArgError, &quot;not supported VT_RECORD WIN32OLE_VARIANT object&quot;);
        }
        ole_val2olevariantdata(val, vt, pvar);
    }
    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-5B-5D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE_VARIANT[i,j,...] #&rarr; element of OLE array.
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the element of WIN32OLE_VARIANT object(OLE array). This method is available only when the variant type of WIN32OLE_VARIANT object is VT_ARRAY.</p>

<p>REMARK:</p>

<pre>The all indices should be 0 or natural number and
lower than or equal to max indices.
(This point is different with Ruby Array indices.)

obj = WIN32OLE_VARIANT.new([[1,2,3],[4,5,6]])
p obj[0,0] # =&gt; 1
p obj[1,0] # =&gt; 4
p obj[2,0] # =&gt; WIN32OLERuntimeError
p obj[0, -1] # =&gt; WIN32OLERuntimeError</pre>

                              <div class="method-source-code" id="5B-5D-source">
            <pre>static VALUE
folevariant_ary_aref(int argc, VALUE *argv, VALUE self)
{
    struct olevariantdata *pvar;
    SAFEARRAY *psa;
    VALUE val = Qnil;
    VARIANT variant;
    LONG *pid;
    HRESULT hr;

    TypedData_Get_Struct(self, struct olevariantdata, &amp;olevariant_datatype, pvar);
    if (!V_ISARRAY(&amp;(pvar-&gt;var))) {
        rb_raise(eWIN32OLERuntimeError,
                 &quot;`[]&#39; is not available for this variant type object&quot;);
    }
    psa = get_locked_safe_array(self);
    if (psa == NULL) {
        return val;
    }

    pid = ary2safe_array_index(argc, argv, psa);

    VariantInit(&amp;variant);
    V_VT(&amp;variant) = (V_VT(&amp;(pvar-&gt;var)) &amp; ~VT_ARRAY) | VT_BYREF;
    hr = SafeArrayPtrOfIndex(psa, pid, &amp;V_BYREF(&amp;variant));
    if (FAILED(hr)) {
        ole_raise(hr, eWIN32OLERuntimeError, &quot;failed to SafeArrayPtrOfIndex&quot;);
    }
    val = ole_variant2val(&amp;variant);

    unlock_safe_array(psa);
    if (pid) free(pid);
    return val;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-5B-5D-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE_VARIANT[i,j,...] = val #&rarr; set the element of OLE array
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set the element of WIN32OLE_VARIANT object(OLE array) to val. This method is available only when the variant type of WIN32OLE_VARIANT object is VT_ARRAY.</p>

<p>REMARK:</p>

<pre>The all indices should be 0 or natural number and
lower than or equal to max indices.
(This point is different with Ruby Array indices.)

obj = WIN32OLE_VARIANT.new([[1,2,3],[4,5,6]])
obj[0,0] = 7
obj[1,0] = 8
p obj.value # =&gt; [[7,2,3], [8,5,6]]
obj[2,0] = 9 # =&gt; WIN32OLERuntimeError
obj[0, -1] = 9 # =&gt; WIN32OLERuntimeError</pre>

                              <div class="method-source-code" id="5B-5D-3D-source">
            <pre>static VALUE
folevariant_ary_aset(int argc, VALUE *argv, VALUE self)
{
    struct olevariantdata *pvar;
    SAFEARRAY *psa;
    VARIANT var;
    VARTYPE vt;
    LONG *pid;
    HRESULT hr;
    VOID *p = NULL;

    TypedData_Get_Struct(self, struct olevariantdata, &amp;olevariant_datatype, pvar);
    if (!V_ISARRAY(&amp;(pvar-&gt;var))) {
        rb_raise(eWIN32OLERuntimeError,
                 &quot;`[]&#39; is not available for this variant type object&quot;);
    }
    psa = get_locked_safe_array(self);
    if (psa == NULL) {
        rb_raise(rb_eRuntimeError, &quot;failed to get SafeArray pointer&quot;);
    }

    pid = ary2safe_array_index(argc-1, argv, psa);

    VariantInit(&amp;var);
    vt = (V_VT(&amp;(pvar-&gt;var)) &amp; ~VT_ARRAY);
    p = val2variant_ptr(argv[argc-1], &amp;var, vt);
    if ((V_VT(&amp;var) == VT_DISPATCH &amp;&amp; V_DISPATCH(&amp;var) == NULL) ||
        (V_VT(&amp;var) == VT_UNKNOWN &amp;&amp; V_UNKNOWN(&amp;var) == NULL)) {
        rb_raise(eWIN32OLERuntimeError, &quot;argument does not have IDispatch or IUnknown Interface&quot;);
    }
    hr = SafeArrayPutElement(psa, pid, p);
    if (FAILED(hr)) {
        ole_raise(hr, eWIN32OLERuntimeError, &quot;failed to SafeArrayPutElement&quot;);
    }

    unlock_safe_array(psa);
    if (pid) free(pid);
    return argv[argc-1];
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-value" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          value #&rarr; Ruby object.
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns Ruby object value from OLE variant.</p>

<pre class="ruby"><span class="ruby-identifier">obj</span> = <span class="ruby-constant">WIN32OLE_VARIANT</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">1</span>, <span class="ruby-constant">WIN32OLE</span><span class="ruby-operator">::</span><span class="ruby-constant">VARIANT</span><span class="ruby-operator">::</span><span class="ruby-constant">VT_BSTR</span>)
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">value</span> <span class="ruby-comment"># =&gt; &quot;1&quot; (not Integer object, but String object &quot;1&quot;)</span>
</pre>

                              <div class="method-source-code" id="value-source">
            <pre>static VALUE
folevariant_value(VALUE self)
{
    struct olevariantdata *pvar;
    VALUE val = Qnil;
    VARTYPE vt;
    int dim;
    SAFEARRAY *psa;
    TypedData_Get_Struct(self, struct olevariantdata, &amp;olevariant_datatype, pvar);

    val = ole_variant2val(&amp;(pvar-&gt;var));
    vt = V_VT(&amp;(pvar-&gt;var));

    if ((vt &amp; ~VT_BYREF) == (VT_UI1|VT_ARRAY)) {
        if (vt &amp; VT_BYREF) {
            psa = *V_ARRAYREF(&amp;(pvar-&gt;var));
        } else {
            psa  = V_ARRAY(&amp;(pvar-&gt;var));
        }
        if (!psa) {
            return val;
        }
        dim = SafeArrayGetDim(psa);
        if (dim == 1) {
            val = rb_funcall(val, rb_intern(&quot;pack&quot;), 1, rb_str_new2(&quot;C*&quot;));
        }
    }
    return val;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-value-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          value = val #&rarr; set WIN32OLE_VARIANT value to val.
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Sets variant value to val. If the val type does not match variant value type(vartype), then val is changed to match variant value type(vartype) before setting val. This method is not available when vartype is VT_ARRAY(except VT_UI1|VT_ARRAY). If the vartype is VT_UI1|VT_ARRAY, the val should be String object.</p>

<pre class="ruby"><span class="ruby-identifier">obj</span> = <span class="ruby-constant">WIN32OLE_VARIANT</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">1</span>) <span class="ruby-comment"># obj.vartype is WIN32OLE::VARIANT::VT_I4</span>
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">value</span> = <span class="ruby-value">3.2</span> <span class="ruby-comment"># 3.2 is changed to 3 when setting value.</span>
<span class="ruby-identifier">p</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">value</span> <span class="ruby-comment"># =&gt; 3</span>
</pre>

                              <div class="method-source-code" id="value-3D-source">
            <pre>static VALUE
folevariant_set_value(VALUE self, VALUE val)
{
    struct olevariantdata *pvar;
    VARTYPE vt;
    TypedData_Get_Struct(self, struct olevariantdata, &amp;olevariant_datatype, pvar);
    vt = V_VT(&amp;(pvar-&gt;var));
    if (V_ISARRAY(&amp;(pvar-&gt;var)) &amp;&amp; ((vt &amp; ~VT_BYREF) != (VT_UI1|VT_ARRAY) || !RB_TYPE_P(val, T_STRING))) {
        rb_raise(eWIN32OLERuntimeError,
                 &quot;`value=&#39; is not available for this variant type object&quot;);
    }
    ole_val2olevariantdata(val, vt, pvar);
    return Qnil;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-vartype" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          vartype #&rarr; OLE variant type.
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns OLE variant type.</p>

<pre class="ruby"><span class="ruby-identifier">obj</span> = <span class="ruby-constant">WIN32OLE_VARIANT</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;string&quot;</span>)
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">vartype</span> <span class="ruby-comment"># =&gt; WIN32OLE::VARIANT::VT_BSTR</span>
</pre>

                              <div class="method-source-code" id="vartype-source">
            <pre>static VALUE
folevariant_vartype(VALUE self)
{
    struct olevariantdata *pvar;
    TypedData_Get_Struct(self, struct olevariantdata, &amp;olevariant_datatype, pvar);
    return RB_INT2FIX(V_VT(&amp;pvar-&gt;var));
}</pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

